﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>为下拉框设置联动填充其他控件</title>
    <script language="JavaScript" src="../../../Comm/JScript.js" type="text/javascript"></script>
    <script type="text/javascript" src="../../../Scripts/bootstrap/js/jquery.min.js"></script>
    <script src="../../../../WF/Scripts/QueryString.js" type="text/javascript"></script>
    <link href="../../../../DataUser/Style/ccbpm.css" rel="stylesheet" type="text/css" />
    <!-- 引用通用的js文件. -->
    <script type="text/javascript" src="../../../Scripts/config.js"></script>
    <script type="text/javascript" src="../../../Comm/Gener.js"></script>
    <script type="text/javascript" language="javascript">

        //页面启动函数.
        var mapExt;
        $(function () {

            var keyOfEn = GetQueryString("KeyOfEn");
            var frmID = GetQueryString("FK_MapData");

            var en = new Entity("BP.Sys.MapAttr", frmID + "_" + keyOfEn);

            var isEnable = en.GetPara("IsFullData");

            if (isEnable == "" || isEnable == 0 || isEnable == undefined) {
                $("#Btn_FullData").hide();
                $("#RB_IsEnableJS_0").attr("checked", true);
            } else {

                $("#Btn_FullData").show();
                $("#RB_IsEnableJS_1").attr("checked", true);
            }
            //设置那个单选按钮可以被选择。

            return;

        });

    </script>
</head>
<body>
    <form id="cc">

        <table style="width:99%;">
            <caption> 设置下拉框在值变化后，填充其他控件与从表 </caption>
            <tr>
                <td>

                    <fieldset>
                        <legend>
                            <label>
                                <input type="radio" value="0" id="RB_IsEnableJS_0" name="RB_IsEnableJS" checked="checked" />
                                不启用
                            </label>
                        </legend>

                        <ul>
                            <li>不设置，不启用，默认为不启用。</li>
                        </ul>
                    </fieldset>

                    <fieldset>
                        <legend>
                            <label><input type="radio" value="1" id="RB_IsEnableJS_1" name="RB_IsEnableJS" />启用 </label>

                        </legend>
                        <ul>
                            <li>启用后需要您配置数据填充模式.</li>
                        </ul>
                    </fieldset>
                </td>
            </tr>

            <tr>
                <td>
                    <input type="button" value="保存" onclick="Save();" />
                    <input type="button" value="设置填充" id="Btn_FullData" onclick="Set();" />
                    <a href="javascript:ShowHidden('sqlexp')"><img src="../../../Img/Btn/Help.gif" />帮助:</a>
                </td>
            </tr>
        </table>

        <div id='sqlexp' style='color: Gray; display: none'>
            <fieldset>
                <legend> 运行效果 </legend>
                <ul>
                    <li>应用场景1：在做一个选择操作员的时候，需要把操作员的电话，邮件填充到主表其他字段里面，需要把操作员的岗位显示到下拉框里面。 </li>
                    <li>人员是一个下拉框，人员变动的时候，其他的控件也在跟着变动。</li>
                </ul>
                <a href="javascript:WinOpen('./Img/DDLFullCtrl.png');">   <img src='./Img/DDLFullCtrl.png' style="width:90%;" /> </a>
            </fieldset>
        </div>

        <div id="Msg">
        </div>
        <script type="text/javascript">


            function Save() {

                var keyOfEn = GetQueryString("KeyOfEn");
                var frmID = GetQueryString("FK_MapData");

                var en = new Entity("BP.Sys.MapAttr", frmID + "_" + keyOfEn);

                var isEnable = $("input[name='RB_IsEnableJS']:checked").val();
                if (isEnable == "1") {
                    en.SetPara("IsFullData", 1);
                    $("#Btn_FullData").show();
                } else {
                    en.SetPara("IsFullData", 0);
                    $("#Btn_FullData").hide();
                }
                en.Update();
                window.location.href = window.location.href;
                return;
            }

            function Set() {
                
                var keyOfEn = GetQueryString("KeyOfEn");
                var frmID = GetQueryString("FK_MapData");
                var extType = GetQueryString("ExtType");
                var myPK = "DDLFullCtrl_" + frmID + "_" + keyOfEn;
                var url = "../FullData/Main.htm?FK_MapData=" + frmID + "&RefPK=" + myPK + "&KeyOfEn=" + keyOfEn + "&ExtType=" + extType;

                window.location.href = url;
                return;
            }
        </script>
    </form>
</body>
</html>
